/*
 * realnumberobject.h
 *
 *  Created on: Oct 27, 2009
 *      Author: price
 */

#ifndef REALNUMBEROBJECT_H_
#define REALNUMBEROBJECT_H_

#include "numberobject.h"

namespace templatipus {

class TRealNumberObject: public TNumberObject {

protected:
	float64 internalValue;
	utf8c retUtf8[10];
	unicodec retUnicode[10];

public:
	//constructor && destructor
	TRealNumberObject();
	TRealNumberObject(const TemplateObject &other);
	TRealNumberObject(const int8 &rhs);
	TRealNumberObject(const int16 &rhs);
	TRealNumberObject(const int32 &rhs);
	TRealNumberObject(const int64 &rhs);
	TRealNumberObject(const float32 &rhs);
	TRealNumberObject(const float64 &rhs);
	TRealNumberObject(const std::wstring& rhs);
	TRealNumberObject(const std::string& rhs);
	TRealNumberObject(const utf8Ptr rhs);
	TRealNumberObject(const unicodePtr rhs);

	virtual ~TRealNumberObject();

	//operations
	virtual const TemplateObject& operator ++();
	virtual const TemplateObject& operator --();

	virtual const TemplateObject& operator +=(const TemplateObject &other);
	virtual const TemplateObject& operator -=(const TemplateObject &other);
	virtual const TemplateObject& operator *=(const TemplateObject &other);
	virtual const TemplateObject& operator /=(const TemplateObject &other);

	TRealNumberObject operator +(const TemplateObject &other);
	TRealNumberObject operator -(const TemplateObject &other);
	TRealNumberObject operator *(const TemplateObject &other);
	TRealNumberObject operator /(const TemplateObject &other);

	//assigning values
	virtual TemplateObject& operator=(const TemplateObject &other);
	virtual TemplateObject& operator=(const int8 &other);
	virtual TemplateObject& operator=(const int16 &other);
	virtual TemplateObject& operator=(const int32 &other);
	virtual TemplateObject& operator=(const int64 &other);
	virtual TemplateObject& operator=(const float32 &other);
	virtual TemplateObject& operator=(const float64 &other);
	virtual TemplateObject& operator=(const std::wstring& other);
	virtual TemplateObject& operator=(const std::string& other);
	virtual TemplateObject& operator=(const utf8Ptr other);
	virtual TemplateObject& operator=(const unicodePtr other);

	//comparison
	virtual tbool operator ==(const TemplateObject &other) const;
	virtual tbool operator !=(const TemplateObject &other) const;
	virtual tbool operator >(const TemplateObject &other) const;
	virtual tbool operator <(const TemplateObject &other) const;
	virtual tbool operator <=(const TemplateObject &other) const;
	virtual tbool operator >=(const TemplateObject &other) const;

	virtual tbool operator &&(const TemplateObject &other) const;
	virtual tbool operator ||(const TemplateObject &other) const;

	//String stuff
	virtual operator std::string() const;
	virtual operator std::wstring() const;

	//Conversion operators
	//Number
	virtual operator tbool() const;
	virtual operator int8() const;
	virtual operator uint8() const;
	virtual operator int16() const;
	virtual operator uint16() const;
	virtual operator int32() const;
	virtual operator uint32() const;
	virtual operator int64() const;
	virtual operator uint64() const;
	virtual operator float32() const;
	virtual operator float64() const;

	virtual TemplateObject * newInstance() const {
		return new TRealNumberObject();
	}
};

}

#endif /* REALNUMBEROBJECT_H_ */
